<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>意见反馈</title>
  <link rel="stylesheet" href="mobile/layui/css/layui.mobile.css">
  <link rel="stylesheet" href="mobile/layui/css/layui.css">
  <link rel="stylesheet" href="mobile/css/yj_css.css">
</head>
<body>
  <header class="yj-header">
    <a href="javascript:history.go(-1)" class="yj-header-return layui-icon">&#xe603;</a>
    <span>意见反馈</span>
    <a class="yj-header-meau"></a>
  </header>
  <div class="yj-content">
    <div class="yj-margin-big">
      <p>您有什么问题想跟我们说？</p>
<!--      <p class="yj-list-item yj-form1-item yj-bgfff yj-mar-t-big">
        <label class="yj-form1-label yj-color-gray-light" style="width: 6em; text-align: center;">联系电话：</label>
        <input class="yj-pad-lr" type="number" placeholder="请输入您的联系方式">
      </p>-->
      <div class="yj-mar-t yj-opinion-textarea yj-bgfff yj-padding-big">
        <textarea rows="10" placeholder="您的建议，使我们进步的源泉" id="complaintReason" name="coReason"></textarea>
        <input type="hidden" id="orderId" name="oId">
      </div>
      <p class="yj-text-small yj-pad-lr yj-mar-t-big yj-color-gray-light">(*^_^*)请详细描述您遇到的问题，有助于我们快速定位并解决问题，或留下您宝贵的建议或意见，我们会认真进行评估！</p>
      <div class="yj-recharge-btn yj-text-center">
        <button class="layui-btn layui-btn-fluid layui-btn-radius yj-bg-main" onclick="addComplaint()">提 交</button>
      </div>
    </div>
  </div>
  <script th:src="@{/mobile/js/jquery.min.js}"></script>
  <script th:src="@{/mobile/layui/layui.js}"></script>
  <script src="mobile/js/jquery.min.js"></script>
  <script src="mobile/js/yj_js.js"></script>
  <script src="mobile/layer/layer.js"></script>
  <script src="mobile/js/jQuery.form.js"></script>
  <script th:inline="javascript">
    var url = [[@{/}]];

      layui.use("layer", function () {
        var layer = layui.layer;
      });
    function getQueryVariable(variable)
    {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
      }
      return(false);
    }

   function addComplaint() {
     var id = getQueryVariable("id");
     //$("#orderId").val(id);
     var coReason=$("#complaintReason").val();
     $.ajax({
       url:url+'complaint/addComplaint',
       data:{
         coReason:coReason,
         oId: id
       },
       success:function (result) {
         if (result.msg=="添加投诉成功"){
           layer.msg("您的投诉已提交！")
           setTimeout(function(){
             window.location.href="order_detail.html?id="+id;
           },1000);
         }else{
         layer.msg(result.msg);
         }
       }
     });
   }
  </script>
</body>
</html>